package com.aaa.filter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ：肖成杰（1752167034@qq.com）
 * @date ：Created in 2022/8/9 14:23
 * @description：
 * @modified By：
 * @version:
 */
//@WebFilter("/*")
public class CodeFilter extends HttpFilter {
    String myEncode = "UTF-8";

    @Override
    protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException {
        req.setCharacterEncoding(myEncode);
        res.setCharacterEncoding(myEncode);
        chain.doFilter(req, res);
    }
}